#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <set>
using namespace std;
class NumArray
{
public:
    NumArray(vector<int> &nums) : nums(nums)
    {
        csum = vector<int>(nums.begin(), nums.end());
        for (int i = 1; i < csum.size(); ++i)
            csum[i] += csum[i - 1];
    }

    int sumRange(int i, int j)
    {
        return csum[j] - csum[i] + nums[i];
    }

private:
    vector<int> csum, nums;
};

/**
 * Your NumArray object will be instantiated and called as such:
 * NumArray* obj = new NumArray(nums);
 * int param_1 = obj->sumRange(i,j);
 */